/*
 *@description:发现页面
 *@Author:@rennan
 *@Date:2024-07-12 14:58:11
 *@version: V1.0.0
*/

<template>
  <div class="my_discovery">
    <!-- 轮播图区域 -->
    <van-swipe :autoplay="3000" lazy-render>
      <van-swipe-item v-for="image in images" :key="image">
        <img :src="image" width="100%" height="200px" />
      </van-swipe-item>
    </van-swipe>

    <!-- 宫格导航区域 -->
    <van-grid :border="false" :column-num="4">
      <van-grid-item v-for="item in gridData" :key="item.id">
        <van-image :src="item.imgUrl" height="40px" />
        <div class="grid_text">{{ item.text }}</div>
      </van-grid-item>
    </van-grid>

    <!-- 发现好歌单 -->
    <div class="music_list">
      <div class="text">发现好歌单</div>
      <van-button plain round type="default" size="small">
        <span>查看更多</span>
      </van-button>
    </div>
    <!-- 歌单列表 -->
    <van-row :gutter="[20, 20]">
      <van-col span="12" v-for="item in musicList" :key="item.id" @click="toMusicList(item.id)">
        <img :src="item.musicImg" alt="" width="100%" height="180px">
        <div>{{ item.auth }}</div>
      </van-col>
    </van-row>
  </div>
</template>
<script setup>
import { ref } from 'vue'
// 宫格数据
const gridData = ref([
  { id: 1, imgUrl: 'https://img.51miz.com/Element/00/23/81/79/3c43ec93_E238179_886f5896.png', text: "每日推荐" },
  { id: 2, imgUrl: 'https://img.zcool.cn/community/010d565a029a3ba801202b0c534c12.jpg@2o.jpg', text: "私人FM" },
  { id: 3, imgUrl: 'https://bpic.588ku.com/element_origin_min_pic/19/06/15/8a0e2a2038edfd0966b0689c29c2a247.jpg', text: "歌单" },
  { id: 4, imgUrl: 'https://bpic.588ku.com/element_origin_min_pic/19/12/19/21c172e2416f2140317925403148d06d.jpg', text: "排行榜" },
])

// 歌单数据
const musicList = ref([
  {id:1,musicImg:'https://ts1.cn.mm.bing.net/th/id/R-C.1402c89bdd48ed2d6f2ecd08ea080b4d?rik=KnpewOGvdoH3dg&riu=http%3a%2f%2fpic.616pic.com%2fbg_w1180%2f00%2f13%2f89%2fP5vFmawY4e.jpg!%2ffw%2f1120&ehk=nGBuTWfv%2fpHszHwLAEevzZO%2b7bZnD8p8xtr0kiFvRs8%3d&risl=&pid=ImgRaw&r=0',auth:'auth1'},
  {id:2,musicImg:'https://pic.616pic.com/ys_bnew_img/00/16/50/iHPqLoVyHd.jpg',auth:'auth2'},
  {id:3,musicImg:'https://photo-static-api.fotomore.com/creative/vcg/veer/612/veer-128736283.jpg',auth:'auth3'},
  {id:4,musicImg:'https://bpic.588ku.com/paixin_pic/22/05/07/f261fedc3e96849dcfce5e78af77d295.jpg',auth:'auth4'}
])

// 轮播图静态数据
const images = [
  'https://img.tukuppt.com/ad_preview/00/10/21/5c992a440439c.jpg!/fw/980',
  'https://img.zcool.cn/community/0166995cb6afbea801214168edf585.jpg@1280w_1l_2o_100sh.jpg',
  'https://images.osogoo.com/article/a63fccba158b584fe8/201904231925167192.jpg?x-oss-process=style/wate_design'
];

// 跳转歌单详情页面
const toMusicList = (id)=>{
  console.log('跳转歌单详情',id);
}
</script>
<style scoped>
.my_discovery {
  margin-top: 10px;
  padding: 0 10px;
  height: calc(100vh - 110px);
  overflow-y: scroll;
}

.grid_text {
  font-size: 15px;
}

.music_list {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.music_list .text {
  color: #000;
  font-size: 18px;
  font-weight: 600;
}

.music_list span {
  color: #000;
}</style>